﻿#include "NormalChatTransfer.h"

NormalChatTransfer::NormalChatTransfer(TransferProxy *proxy)
    : TransferBase(proxy) {

}

QString NormalChatTransfer::transferPrefix() {
    return priefix();
}

QString NormalChatTransfer::priefix() {
    return "NormalChat";
}

void NormalChatTransfer::send(const QVariant &var, const QVariant &extra)
{
    QString value = var.toString();
    QString sendStr = QString("%1%2%3").arg(transferPrefix()).arg(INFOFLAG).arg(value);
    qDebug() << "NormalChatTransfer send str = " << sendStr;
    mTransproxy->getSocket()->write(sendStr.toStdString().c_str());
    if(extra.toBool()) {
        mTransproxy->updataComInfo(true, value);
    }
}

void NormalChatTransfer::received(const QVariant &var) {
    qDebug() << "recive info = " << var.toString();
    mTransproxy->updataComInfo(false, var.toString());
}
